package temp.test;

import java.io.File;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.Test;

public class TempTest2 {
	private HttpClient client = new DefaultHttpClient();

	@Test
	public void test() throws Exception {
		MultipartEntity entity = new MultipartEntity();
		entity.addPart("regionsFile", new FileBody(new File(
				"D:/wp/project/adsky/docs/upload/baiduRegions.xlsx")));
		HttpPost request = new HttpPost(
				"http://localhost:8080/adsky/upRegionsBdConst.jspx");
		request.setEntity(entity);
		HttpResponse response = client.execute(request);
		int status = response.getStatusLine().getStatusCode();
		System.out.println(status);
	}
}
